﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WheelClean2.Converters
{
  
    public class IntToCurrentStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int Value)
            {
                var v = System.Convert.ToInt16(value);
                string result = "";
                switch(v)
                {
                    case 0:
                        result = "未确认";
                        break;
                    case 1:
                        result = "已确认";
                        break;
                    case 2:
                        result = "已消除";
                        break;
                }

                return result;
            }
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is String Value)
            {
                var v = value.ToString();
                int result = 0;
                switch (v)
                {
                    case "未确认":
                        result = 0;
                        break;
                    case "已确认":
                        result = 1;
                        break;
                    case "已消除":
                        result = 2;
                        break;
                }
                return result;
            }
            return 0;
        }
    }
}
